<?php

namespace App\Http\Controllers\User;

use App\Http\Servers\User\BaseServer;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class CommonController extends Controller
{
    public function __construct(Request $request, BaseServer $baseServer)
    {
        if (!\Auth::check()) {
            $this->middleware('auth');
        } else {
            config(['set' => $baseServer->getConfig()]);

            $share = [
                'logo' => \App\Image::where('id', \Auth::user()->image)->value('path'),
                'frame' => $baseServer->getFrame(),
                'chunklist' => $baseServer->getChunk(),
            ];

            view()->share($share);
        }
    }
}
